#ifndef DATAFORMATWIZARD_H
#define DATAFORMATWIZARD_H

#include <QWizard>

class BinaryFile;
class BinaryDataFormatUI;
class TextFile;
class UnknownFile;
class FileGroup;

class QStandardItemModel;
class QScrollArea;
class QTreeView;
class QCheckBox;
class QPushButton;
class QVBoxLayout;
class QHBoxLayout;
class QGroupBox;
class QSpinBox;
class QComboBox;
class QLabel;

class DataFormatWizard : public QWizard
{
public:
    DataFormatWizard(QList<BinaryFile *> *binaryFileList,
                     QList<FileGroup *> *binaryFileGroupList,
                     QStandardItemModel *binaryFileGroupModel,
                     int numNewBinaryFiles,
                     QList<TextFile *> *textFileList,
                     QList<FileGroup *> *textFileGroupList,
                     QStandardItemModel *textFileGroupModel,
                     int numNewTextFiles,
                     QList<UnknownFile *> *unknownFileList,
                     QList<FileGroup *> *unknownFileGroupList,
                     QStandardItemModel *unknownFileGroupModel,
                     int numUnknownFiles,
                     QWidget *parent = 0);
};

class IntroPage : public QWizardPage
{
public:
    IntroPage(QWidget *parent = 0);
};

class BinaryFileGroupPage : public QWizardPage
{
    Q_OBJECT

public:
    BinaryFileGroupPage(QList<BinaryFile *> *binaryFileList,
                        QList<FileGroup *> *binaryFileGroupList,
                        QStandardItemModel *binaryFileGroupModel,
                        int numNewBinaryFiles,
                        QWidget *parent = 0);

    bool isComplete() const;

signals:
    void newGroupAdded();

public slots:
    void submitGroup();
    void addToGroup();

private:
    bool isAllFilesInGroups;
    QList<BinaryFile *> *binaryFileList;
    QList<FileGroup *> *binaryFileGroupList;
    int numNewBinaryFiles;


    QVBoxLayout *layout_page;

    QGroupBox *groupBox_newFiles;
    QVBoxLayout *layout_newFileList;
    QList<QCheckBox *> *checkBox_newFileList;

    QGroupBox *groupBox_oldFiles;
    QVBoxLayout *layout_oldFileTree;
    QStandardItemModel *binaryFileGroupModel;
    QTreeView *treeView_oldFileTree;

    QHBoxLayout *layout_buttons;
    QPushButton *button_select;
    QPushButton *button_add;
    QPushButton *button_submit;

    QGroupBox *groupBox_message;
    QVBoxLayout *layout_message;
    QLabel *label_message;
};

class BinaryDataFormatPage : public QWizardPage
{
    Q_OBJECT

public:
    BinaryDataFormatPage(QList<BinaryFile *> *binaryFileList,
                         QList<FileGroup *> *binaryFileGroupList,
                         QWidget *parent = 0);
    void initializePage();
    bool isComplete() const;

protected slots:
    void newGroupAdded();
    void submitDataFormat();
    void goToPreviousGroup();
    void goToNextGroup();

private:
    QList<BinaryFile *> *binaryFileList;
    QList<FileGroup *> *binaryFileGroupList;
    int numNewBinaryFiles;
    int numNewGroups;
    int currentGroupIndex;
    int status;
    bool isAllGroupsSet;

    QVBoxLayout *layout_page;
    QHBoxLayout *layout_buttons;
    QPushButton *button_previous;
    QPushButton *button_next;
    QPushButton *button_submit;
    QList<QGroupBox *> *groupBoxList_dataFormat;
    QList<BinaryDataFormatUI *> *binaryDataFormatUI;
};

#endif // DATAFORMATWIZARD_H
